/**
 * 作者:TL(tongling19890103@126.com)
 * 时间：2020-07-17.
 * 功能：
 */

layui.use(['tree', 'layer','laypage','element'], function(){
    var layer = layui.layer
        ,element = layui.element
        ,laypage = layui.laypage
        ,$ = layui.jquery;
    // 回收站分页
    laypage.render({
        elem: 'recyclebinPage'
        ,count: 100 //总条数，从服务端获取
        // ,first: false
        // ,last: false
        // ,prev: '<em><</em>'
        // ,next: '<em>></em>'
        ,jump: function(obj){
            console.log(obj)
            // 当前页点击
            var currentPage = obj.curr
            getDataList(currentPage)

        }
    });


    // 编辑按钮点击事件
   $(document).on('click','.edit-btn',function(){
       var listId = $(this).parents('tr').data('id');
       layer.msg('你选择的是'+listId)
   })
    // 删除按钮点击事件
   $(document).on('click','.delete-btn',function(){
       var listId = $(this).parents('tr').data('id');
       layer.msg('你删除的是'+listId)
   })
    // 查询按钮点击事件
    $(document).on('click','.form-inline-search',function(){
        getDataList(1);

    })

    // 获取列表
    function getDataList(page){
        var knowhouseName = $("#knowHouseName").val();
        var recycleType = $("#recycleType").val();
        layer.msg('你查询的是'+knowhouseName+"；你选择的是"+recycleType);
        var resultData = [
            {
                id:0
                ,title:'房产税征收范围'
                ,backDate:'2019.11。24'
                ,type:'到期'
                ,knowHouse:'知识库1'
                ,time:'2019.11.24 13:00'
                ,creater:'张东阳'
                ,createrNo:'D483924'
            }
            ,{
                id:1
                ,title:'房产税征收范围'
                ,backDate:'2019.11。24'
                ,type:'到期'
                ,knowHouse:'知识库1'
                ,time:'2019.11.24 13:00'
                ,creater:'张东阳'
                ,createrNo:'D483924'
            }
            ,{
                id:2
                ,title:'房产税征收范围'
                ,backDate:'2019.11。24'
                ,type:'到期'
                ,knowHouse:'知识库1'
                ,time:'2019.11.24 13:00'
                ,creater:'张东阳'
                ,createrNo:'D483924'
            }
            ,{
                id:3
                ,title:'房产税征收范围'
                ,backDate:'2019.11。24'
                ,type:'到期'
                ,knowHouse:'知识库1'
                ,time:'2019.11.24 13:00'
                ,creater:'张东阳'
                ,createrNo:'D483924'
            }
            ,{
                id:4
                ,title:'房产税征收范围'
                ,backDate:'2019.11。24'
                ,type:'到期'
                ,knowHouse:'知识库1'
                ,time:'2019.11.24 13:00'
                ,creater:'张东阳'
                ,createrNo:'D483924'
            }
            ,{
                id:5
                ,title:'房产税征收范围'
                ,backDate:'2019.11。24'
                ,type:'到期'
                ,knowHouse:'知识库1'
                ,time:'2019.11.24 13:00'
                ,creater:'张东阳'
                ,createrNo:'D483924'
            }
            ,{
                id:6
                ,title:'房产税征收范围'
                ,backDate:'2019.11。24'
                ,type:'到期'
                ,knowHouse:'知识库1'
                ,time:'2019.11.24 13:00'
                ,creater:'张东阳'
                ,createrNo:'D483924'
            }
            ,{
                id:7
                ,title:'房产税征收范围'
                ,backDate:'2019.11。24'
                ,type:'到期'
                ,knowHouse:'知识库1'
                ,time:'2019.11.24 13:00'
                ,creater:'张东阳'
                ,createrNo:'D483924'
            }
            ,{
                id:8
                ,title:'房产税征收范围'
                ,backDate:'2019.11。24'
                ,type:'到期'
                ,knowHouse:'知识库1'
                ,time:'2019.11.24 13:00'
                ,creater:'张东阳'
                ,createrNo:'D483924'
            }
            ,{
                id:9
                ,title:'房产税征收范围'
                ,backDate:'2019.11。24'
                ,type:'到期'
                ,knowHouse:'知识库1'
                ,time:'2019.11.24 13:00'
                ,creater:'张东阳'
                ,createrNo:'D483924'
            }
        ]
        var resultItemsTemp = ''
        if(resultData.lenthL<1){
            resultItemsTemp = '<tr><td colspan="8">暂无内容</td></tr>'
        }
        for(var i = 0;i<resultData.length;i++){
            resultItemsTemp += ' <tr data-id="'+resultData[i].id+'">\n' +
                '    <td>'+resultData[i].title+'</td>\n' +
                '    <td>'+resultData[i].backDate+'</td>\n' +
                '    <td>'+resultData[i].type+'</td>\n' +
                '    <td>'+resultData[i].knowHouse+'</td>\n' +
                '    <td>'+resultData[i].time+'</td>\n' +
                '    <td>'+resultData[i].creater+'</td>\n' +
                '    <td>'+resultData[i].createrNo+'</td>\n' +
                '    <td>\n' +
                '        <a href="javascript:void(0)" class="edit-btn"><img src="../../image/detail.png" alt=""></a>\n' +
                '        <a href="javascript:void(0)" class="delete-btn"><img src="../../image/delete.png" alt=""></a>\n' +
                '    </td>\n' +
                '</tr>'
        }
        $("#recycleBinList").html(resultItemsTemp)
    }

});